package com.gxa.controller;

import com.gxa.entity.Order;
import com.gxa.service.OrderService;
import com.gxa.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = "订单服务")
public class OrderController {
    @Autowired
    private OrderService orderService;
//测试地址：    http://localhost:9001/order/create?userId=10&productId=100&count=2&money=200
    @ApiOperation(value = "创建订单")
    @GetMapping("/order/create")
    public Result create(Order order) {
        System.out.println("------------>order--"+order);
        order.setStatus(0);
        this.orderService.create(order);
        return new Result().ok();
    }

}
